//
//  ChanPinLeiBiaoGeTableViewCell.m
//  MyYiJianKangApp
//
//  Created by 张国文 on 16/5/5.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "ChanPinLeiBiaoGeTableViewCell.h"
#import "JianCeResultOnShiLiBaoGaoModel.h"
#import "ZGWDiseaseOnShiLiBaoGaoModel.h"

@interface ChanPinLeiBiaoGeTableViewCell ()<KWFormViewDataSource, KWFormViewDelegate>

@property (nonatomic, strong) NSMutableArray *BiaoGeDataArray; // 表格数据源

@property (nonatomic, assign) BOOL isDiease; // 是否是疾病

@end

@implementation ChanPinLeiBiaoGeTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

//- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
//{
//    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
//    if (self) {
//        [self addMySubview];
//    }
//    return self;
//}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier withDataArray:(NSArray *)array withIndexPath:(NSIndexPath *)indexpath isDiease:(NSString *)isOrNo
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        if ([isOrNo isEqualToString:@"YES"]) {
            self.isDiease = YES;
        } else if ([isOrNo isEqualToString:@"NO"]) {
            self.isDiease = NO;
        }
        [self addMySubview:array withIndexPath:indexpath];
    }
    return self;
}

// 布局
- (void)addMySubview:(NSArray *)dataArray withIndexPath:(NSIndexPath *)indexPath
{
    self.myIndexPath = indexPath;
    
    UILabel *jianCeResultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 28 * kAdjustParamater)];
    jianCeResultLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.08];
    jianCeResultLabel.text = @"检测结果";
    jianCeResultLabel.textColor = [UIColor blackColor];
    jianCeResultLabel.textAlignment = NSTextAlignmentCenter;
    jianCeResultLabel.font = [UIFont systemFontOfSize:k15Big];
    [self.contentView addSubview:jianCeResultLabel];
    
    
    //    self.jianCeResultArray = [NSMutableArray arrayWithObjects:@{@"diseaseName":@"高血脂症", @"zhishu":@"1.0", @"jiBingFengXian": @"5"},@{@"diseaseName":@"冠心病", @"zhishu":@"2.0", @"jiBingFengXian": @"4"}, @{@"diseaseName":@"心肌梗死", @"zhishu":@"3.0", @"jiBingFengXian": @"3"}, @{@"diseaseName":@"静脉栓塞", @"zhishu":@"4.0", @"jiBingFengXian": @"2"}, @{@"diseaseName":@"脑卒中", @"zhishu":@"5.0", @"jiBingFengXian": @"1"}, nil];
    self.jianCeResultArray = [NSMutableArray arrayWithArray:dataArray];
    // 数据源初始化
//    self.BiaoGeDataArray = [NSMutableArray array];
//    for (NSDictionary *tempDic in self.jianCeResultArray) {
//        JianCeResultOnShiLiBaoGaoModel *model = [[JianCeResultOnShiLiBaoGaoModel alloc] init];
//        [model setValuesForKeysWithDictionary:tempDic];
//        [self.BiaoGeDataArray addObject:model];
//    }
    
    // 疾病风险
    self.jiBingFengXianBiaoGe = [[KWFormView alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, jianCeResultLabel.bottom + 28 * kAdjustParamater, 345 * kAdjustParamater, 34 * kAdjustParamater)];
    self.jiBingFengXianBiaoGe.dataSource = self;
    self.jiBingFengXianBiaoGe.delegate = self;
    self.jiBingFengXianBiaoGe.userInteractionEnabled = YES;
    self.jiBingFengXianBiaoGe.tag = 300;
    [self.contentView addSubview:_jiBingFengXianBiaoGe];
    
    
    // 构建表格
    self.myBiaoGe = [[KWFormView alloc] initWithFrame:CGRectMake(15 * kAdjustParamater, self.jiBingFengXianBiaoGe.bottom - 1 * kAdjustParamater, 345, self.BiaoGeDataArray.count * 30 * kAdjustParamater)];
    self.myBiaoGe.dataSource = self;
    self.myBiaoGe.delegate = self;
    self.myBiaoGe.userInteractionEnabled = YES;
    self.myBiaoGe.tag = 302;
    [self.contentView addSubview:_myBiaoGe];
    
    // 底部灰色条
    UILabel *grayLineOnBottom = [[UILabel alloc] initWithFrame:CGRectMake(0, self.myBiaoGe.bottom + 120 * kAdjustParamater, kScreenWidth, 1 * kAdjustParamater)];
    grayLineOnBottom.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.07];
    [self.contentView addSubview:grayLineOnBottom];
    
    // 添加检测项目、风险指数、风险等级View
    UILabel *jianCeXiangMuLabel = [[UILabel alloc] initWithFrame:CGRectMake(7 * kAdjustParamater, 7 * kAdjustParamater, 66 * kAdjustParamater, 20 * kAdjustParamater)];
    jianCeXiangMuLabel.backgroundColor = [UIColor colorWithRed:106 / 255.0 green:198 / 255.0 blue:223 / 255.0 alpha:1];
    jianCeXiangMuLabel.text = @"检测项目";
    jianCeXiangMuLabel.textColor = [UIColor blackColor];
    jianCeXiangMuLabel.textAlignment = NSTextAlignmentCenter;
    jianCeXiangMuLabel.font = [UIFont systemFontOfSize:k13Big];
    jianCeXiangMuLabel.layer.cornerRadius = 5 * kAdjustParamater;
    jianCeXiangMuLabel.layer.masksToBounds = YES;
    [self.jiBingFengXianBiaoGe addSubview:jianCeXiangMuLabel];
    
    UILabel *jieSuoZhuangTaiLabel = [[UILabel alloc] initWithFrame:CGRectMake((80 + 7) * kAdjustParamater, 7 * kAdjustParamater, 66 * kAdjustParamater, 20 * kAdjustParamater)];
    jieSuoZhuangTaiLabel.backgroundColor = [UIColor colorWithRed:106 / 255.0 green:198 / 255.0 blue:223 / 255.0 alpha:1];
    jieSuoZhuangTaiLabel.text = @"解锁状态";
    jieSuoZhuangTaiLabel.textColor = [UIColor blackColor];
    jieSuoZhuangTaiLabel.textAlignment = NSTextAlignmentCenter;
    jieSuoZhuangTaiLabel.font = [UIFont systemFontOfSize:k13Big];
    jieSuoZhuangTaiLabel.layer.cornerRadius = 5 * kAdjustParamater;
    jieSuoZhuangTaiLabel.layer.masksToBounds = YES;
    [self.jiBingFengXianBiaoGe addSubview:jieSuoZhuangTaiLabel];
    
    if (self.isDiease == YES) {
        UILabel *fengXianZhiShuLabel = [[UILabel alloc] initWithFrame:CGRectMake((160 + 7) * kAdjustParamater, 7 * kAdjustParamater, 66 * kAdjustParamater, 20 * kAdjustParamater)];
        fengXianZhiShuLabel.backgroundColor = [UIColor colorWithRed:106 / 255.0 green:198 / 255.0 blue:223 / 255.0 alpha:1];
        fengXianZhiShuLabel.text = @"风险指数";
        fengXianZhiShuLabel.textColor = [UIColor blackColor];
        fengXianZhiShuLabel.textAlignment = NSTextAlignmentCenter;
        fengXianZhiShuLabel.font = [UIFont systemFontOfSize:k13Big];
        fengXianZhiShuLabel.layer.cornerRadius = 5 * kAdjustParamater;
        fengXianZhiShuLabel.layer.masksToBounds = YES;
        [self.jiBingFengXianBiaoGe addSubview:fengXianZhiShuLabel];
        
        UILabel *fengXianDengJiLabel = [[UILabel alloc] initWithFrame:CGRectMake((80 + 80 + 80 + 19) * kAdjustParamater, 7 * kAdjustParamater, 66 * kAdjustParamater, 20 * kAdjustParamater)];
        fengXianDengJiLabel.backgroundColor = [UIColor colorWithRed:106 / 255.0 green:198 / 255.0 blue:223 / 255.0 alpha:1];
        fengXianDengJiLabel.text = @"风险等级";
        fengXianDengJiLabel.textColor = [UIColor blackColor];
        fengXianDengJiLabel.textAlignment = NSTextAlignmentCenter;
        fengXianDengJiLabel.font = [UIFont systemFontOfSize:k13Big];
        fengXianDengJiLabel.layer.cornerRadius = 5 * kAdjustParamater;
        fengXianDengJiLabel.layer.masksToBounds = YES;
        [self.jiBingFengXianBiaoGe addSubview:fengXianDengJiLabel];
    }
    
   
    
    if (self.isDiease == NO) {
        UILabel *pingJiaLabel = [[UILabel alloc] initWithFrame:CGRectMake(220* kAdjustParamater, 7 * kAdjustParamater, 66 * kAdjustParamater, 20 * kAdjustParamater)];
        pingJiaLabel.backgroundColor = [UIColor colorWithRed:106 / 255.0 green:198 / 255.0 blue:223 / 255.0 alpha:1];
        pingJiaLabel.text = @"评价";
        pingJiaLabel.textColor = [UIColor blackColor];
        pingJiaLabel.textAlignment = NSTextAlignmentCenter;
        pingJiaLabel.font = [UIFont systemFontOfSize:k13Big];
        pingJiaLabel.layer.cornerRadius = 5 * kAdjustParamater;
        pingJiaLabel.layer.masksToBounds = YES;
        [self.jiBingFengXianBiaoGe addSubview:pingJiaLabel];
    }
    
    
    // 记录下一个解锁图片的Y位置
    CGFloat nextJieSuoImageStartY = 0.0;
    // 添加解锁状态图片
    for (int i = 0; i < self.jianCeResultArray.count; i++) {
        ZGWDiseaseOnShiLiBaoGaoModel *model = self.jianCeResultArray[i];
        NSString *isUnlock = model.is_unlock;
        UIImageView *jieSuoZhuangTaiImageV = [[UIImageView alloc] initWithFrame:CGRectMake(81 * kAdjustParamater, 2 * kAdjustParamater + nextJieSuoImageStartY, 78 * kAdjustParamater, 26 * kAdjustParamater)];
        if ([isUnlock isEqualToString:@"1"]) {
            jieSuoZhuangTaiImageV.image = [UIImage imageNamed:@"示例报告新切图-03"];
        } else if ([isUnlock isEqualToString:@"0"]) {
            jieSuoZhuangTaiImageV.image = [UIImage imageNamed:@"示例报告新切图-01"];
        }
        [self.myBiaoGe addSubview:jieSuoZhuangTaiImageV];
        nextJieSuoImageStartY = nextJieSuoImageStartY + 30 * kAdjustParamater;
    }
    
#warning 如果是个性天赋或者代谢则要记录风险提示框
    
   
    if (self.isDiease == NO) {
        // 记录下一个风险提示框的的Y位置
        CGFloat nextAlertLabelStartY = 0.0;
        // 说明是个性天赋或者代谢
        for (int i = 0; i < self.jianCeResultArray.count; i++) {
            ZGWDiseaseOnShiLiBaoGaoModel *model = self.jianCeResultArray[i];
            NSString *isUnlock = model.is_unlock;
            UILabel *fengxianLevelLabel = [[UILabel alloc] initWithFrame:CGRectMake(170 * kAdjustParamater, 2 + nextAlertLabelStartY, 160 * kAdjustParamater, 26 * kAdjustParamater)];
            fengxianLevelLabel.backgroundColor = [UIColor whiteColor];
            // 单项的名字
            NSString *danXiangName = model.name;
            if ([isUnlock isEqualToString:@"1"]) {
                // 说明已经解锁
                // 判断风险等级
                NSString *fengXianDengJiString = model.risk_level;
                if ([fengXianDengJiString isEqualToString:@"0"]) {
                    // 弱
                    fengxianLevelLabel.text = [NSString stringWithFormat:@"您的%@弱", danXiangName];
                } else if ([fengXianDengJiString isEqualToString:@"1"]) {
                    // 较弱
                    fengxianLevelLabel.text = [NSString stringWithFormat:@"您的%@较弱", danXiangName];
                } else if ([fengXianDengJiString isEqualToString:@"2"]) {
                    // 正常
                    fengxianLevelLabel.text = [NSString stringWithFormat:@"您的%@正常", danXiangName];
                } else if ([fengXianDengJiString isEqualToString:@"3"]) {
                    // 较强
                    fengxianLevelLabel.text = [NSString stringWithFormat:@"您的%@较强", danXiangName];
                } else if ([fengXianDengJiString isEqualToString:@"4"]) {
                    // 强
                    fengxianLevelLabel.text = [NSString stringWithFormat:@"您的%@强", danXiangName];
                }
            } else if ([isUnlock isEqualToString:@"0"]) {
                // 说明未解锁
                fengxianLevelLabel.text = @"--------------------";
            }
            fengxianLevelLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
            fengxianLevelLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:k14Big];
            fengxianLevelLabel.textAlignment = NSTextAlignmentCenter;
            [self.myBiaoGe addSubview:fengxianLevelLabel];
            nextAlertLabelStartY = nextAlertLabelStartY + 30 * kAdjustParamater;
        }
    }
    
    // 风险等级说明
    UILabel *fengXianDengJiShuoMingLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 * kAdjustParamater, self.myBiaoGe.bottom + 25 * kAdjustParamater, 105 * kAdjustParamater, 15 * kAdjustParamater)];
    //   fengXianDengJiShuoMingLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    fengXianDengJiShuoMingLabel.text = @"风险等级说明";
    fengXianDengJiShuoMingLabel.textAlignment = NSTextAlignmentRight;
    fengXianDengJiShuoMingLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    fengXianDengJiShuoMingLabel.font = [UIFont systemFontOfSize:k15Big];
    [self.contentView addSubview:fengXianDengJiShuoMingLabel];
    
    // 风险等级说明图片
    UIImageView *fengXianDengJiImageV = [[UIImageView alloc] initWithFrame:CGRectMake(fengXianDengJiShuoMingLabel.right + 15 * kAdjustParamater, fengXianDengJiShuoMingLabel.top - 15 * kAdjustParamater, 180 * kAdjustParamater, 42 * kAdjustParamater)];
    fengXianDengJiImageV.image = [UIImage imageNamed:@"newFengXianDengJiShuoMing-shilibaogao"];
    [self.contentView addSubview:fengXianDengJiImageV];
    
    // 风险指数说明
    
    UILabel *fengXianZhiShuShuoMingLabel = [[UILabel alloc] initWithFrame:CGRectMake(0 * kAdjustParamater, fengXianDengJiShuoMingLabel.bottom + 25 * kAdjustParamater, 105 * kAdjustParamater, 15 * kAdjustParamater)];
    //  fengXianZhiShuShuoMingLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    fengXianZhiShuShuoMingLabel.text = @"风险指数说明";
    fengXianZhiShuShuoMingLabel.textAlignment = NSTextAlignmentRight;
    fengXianZhiShuShuoMingLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    fengXianZhiShuShuoMingLabel.font = [UIFont systemFontOfSize:k15Big];
    [self.contentView addSubview:fengXianZhiShuShuoMingLabel];
    
    // 风险指数内容说明
    UILabel *fengXianZhiShuContentLabel = [[UILabel alloc] initWithFrame:CGRectMake(fengXianZhiShuShuoMingLabel.right + 15 * kAdjustParamater, fengXianZhiShuShuoMingLabel.top - 2 * kAdjustParamater
                                                                                    , 230 * kAdjustParamater, 50 * kAdjustParamater)];
    //  fengXianZhiShuContentLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    fengXianZhiShuContentLabel.numberOfLines = 0;
    fengXianZhiShuContentLabel.textColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    fengXianZhiShuContentLabel.font = [UIFont systemFontOfSize:k15Big];
    fengXianZhiShuContentLabel.text = @"自主研发风险指数计算体系，参照行业标杆23 andme的计算方法。";
    // 设置行间距
    [fengXianZhiShuContentLabel setAttributedText:[[NetStatusHandle shareHandle] setHangJianJvOfLabel:fengXianZhiShuContentLabel.text lineHeight:5]];
    [fengXianZhiShuContentLabel sizeToFit];
    [self.contentView addSubview:fengXianZhiShuContentLabel];
    
    
}

#pragma mark - 表格代理
- (NSInteger)numberOfRowsInFormView:(KWFormView *)formView
{
    if (formView.tag == 300) {
        // 风险等级
        return 1;
    } else if (formView.tag == 302) {
        // 具体表格
        return self.jianCeResultArray.count;
    }
    return 0;
}

- (NSInteger)formViewColumnsInRow:(KWFormView *)formView
{
    if (formView.tag == 300) {
        if (self.isDiease == YES) {
            // 疾病
            // 疾病风险
            return 4;
        } else if (self.isDiease == NO) {
            // 个性
            
            return 3;
        }
    }  else if (formView.tag == 302) {
        if (self.isDiease == YES) {
            // 疾病具体表格
            return 5;
        } else if (self.isDiease == NO) {
            // 个性具体表格
            return 3;
        }
     
    }
    return 0;
}

- (CGFloat)formView:(KWFormView *)formView widthForColumn:(NSInteger)column
{
    if (formView.tag == 300) {
        if (self.isDiease == YES) {
            // 疾病
            // 疾病风险
            if (column == 0) {
                return 80 * kAdjustParamater;
            } else if (column == 1) {
                return 80 * kAdjustParamater;
            } else if (column == 2) {
                return 80 * kAdjustParamater;
            } else if (column == 3) {
                return 105 * kAdjustParamater;
            }
        } else if (self.isDiease == NO) {
            // 个性
            // 疾病风险
            if (column == 0) {
                return 80 * kAdjustParamater;
            } else if (column == 1) {
                return 80 * kAdjustParamater;
            } else if (column == 2) {
                return 185 * kAdjustParamater;
            }
        }
      
    }  else if (formView.tag == 302) {
        if (self.isDiease == YES) {
            // 疾病
            // 具体表格
            if (column == 0) {
                return 80 * kAdjustParamater;
            } else if (column == 1) {
                return 80 * kAdjustParamater;
            } else if (column == 2)  {
                return 80 * kAdjustParamater;
            } else if (column == 3) {
                return 55 * kAdjustParamater;
            } else if (column == 4) {
                return 50 * kAdjustParamater;
            }
        } else if (self.isDiease == NO) {
            // 个性
            if (column == 0) {
                return 80 * kAdjustParamater;
            } else if (column == 1) {
                return 80 * kAdjustParamater;
            } else if (column == 2)  {
                return 185 * kAdjustParamater;
            }
        }
       
    }
    return 0;
}

- (CGFloat)formView:(KWFormView *)formView heightForRow:(NSInteger)row
{
    if (formView.tag == 300) {
        // 疾病风险
        return 34 * kAdjustParamater;
    }  else if (formView.tag == 302) {
        // 具体表格
        return 30 * kAdjustParamater;
    }
    return 0;
}

- (UIColor *)formViewBorderColor:(KWFormView *)formView
{
    return kCyanColor;
}

- (UIColor *)formView:(KWFormView *)formView contentColorOfColumn:(NSInteger)column inRow:(NSInteger)row
{
    if (formView.tag == 300) {
        // 疾病风险
        return [UIColor blackColor];
    }  else if (formView.tag == 302) {
        if (self.isDiease == YES) {
            // 疾病
            // 具体表格
            return [UIColor blackColor];
        } else if (self.isDiease == NO) {
            // 个性
            // 具体表格
            return [UIColor blackColor];
        }
        
    }
    return nil;
}

// 背景颜色
- (UIColor *)formView:(KWFormView *)formView colorOfColumn:(NSInteger)column inRow:(NSInteger)row
{
    if (formView.tag == 300) {
        // 疾病风险
        return [UIColor whiteColor];
    }  else if (formView.tag == 302) {
        if (self.isDiease == YES) {
            // 疾病
            if (column == 3) {
                // 获取风险值
                ZGWDiseaseOnShiLiBaoGaoModel *tempModel = self.jianCeResultArray[row];
                
                
                // 获取是否解锁
                NSString *isUnlock = tempModel.is_unlock;
                //      CGFloat fengXianZhiFloat = [fengXianZhi floatValue];
                if ([isUnlock isEqualToString:@"1"]) {
                    //                if (0 <= fengXianZhiFloat && fengXianZhiFloat <= 0.5) {
                    //                    // 说明是低风险
                    //                    return [UIColor colorWithRed:83 / 255.0 green:134 / 255.0 blue:198 / 255.0 alpha:1];
                    //                } else if (0.5 < fengXianZhiFloat && fengXianZhiFloat <= 0.9) {
                    //                    // 说明是较低风险
                    //                    return [UIColor colorWithRed:182 / 255.0 green:201 / 255.0 blue:223 / 255.0 alpha:1];
                    //                } else if (0.9 < fengXianZhiFloat && fengXianZhiFloat <= 1.1) {
                    //                    // 说明是正常风险
                    //                    return [UIColor colorWithRed:190 / 255.0 green:208 / 255.0 blue:152 / 255.0 alpha:1];
                    //                } else if (1.1 < fengXianZhiFloat && fengXianZhiFloat <= 2.0) {
                    //                    // 说明是较高风险
                    //                    return [UIColor colorWithRed:239 / 255.0 green:234 / 255.0 blue:60 / 255.0 alpha:1];
                    //                } else if (2.0 < fengXianZhiFloat) {
                    //                    // 说明是高风险
                    //                    return [UIColor redColor];
                    //                }
                    // 风险等级
                    NSString *fengXianLevel = tempModel.risk_level;
                    if ([fengXianLevel isEqualToString:@"0"]) {
                        // 说明是低风险
                        return [UIColor colorWithRed:83 / 255.0 green:134 / 255.0 blue:198 / 255.0 alpha:1];
                    } else if ([fengXianLevel isEqualToString:@"1"]) {
                        // 说明是较低风险
                        return [UIColor colorWithRed:182 / 255.0 green:201 / 255.0 blue:223 / 255.0 alpha:1];
                    } else if ([fengXianLevel isEqualToString:@"2"]) {
                        // 说明是正常风险
                        return [UIColor colorWithRed:190 / 255.0 green:208 / 255.0 blue:152 / 255.0 alpha:1];
                    } else if ([fengXianLevel isEqualToString:@"3"]) {
                        // 说明是较高风险
                        return [UIColor colorWithRed:239 / 255.0 green:234 / 255.0 blue:60 / 255.0 alpha:1];
                    } else if ([fengXianLevel isEqualToString:@"4"]) {
                        // 说明是高风险
                        return [UIColor redColor];
                    }
                    
                } else if ([isUnlock isEqualToString:@"0"]) {
                    return [UIColor whiteColor];
                }
                
            } else {
                return [UIColor whiteColor];
            }
            
            
        } else if (self.isDiease == NO) {
            // 单项
            return [UIColor whiteColor];
        }
       
    }
    return nil;
}

- (NSString *)formView:(KWFormView *)formView textForColumn:(NSInteger)column inRow:(NSInteger)row
{
    if (formView.tag == 300) {
        // 疾病风险
        if (column == 0) {
            return @"";
        } else if (column == 1) {
            return @"";
        } else if (column == 2) {
            return @"";
        }
    }  else if (formView.tag == 302) {
        // 具体数值
        if (self.isDiease == YES) {
            // 疾病
            // 获取具体数值
            ZGWDiseaseOnShiLiBaoGaoModel *tempModel = self.jianCeResultArray[row];
            // 获取是否已经解锁
            NSString *isUnLock = tempModel.is_unlock;
            if (column == 0) {
                // 疾病的名字
                return tempModel.name;
            } else if (column == 2) {
                if ([isUnLock isEqualToString:@"1"]) {
                    return [NSString stringWithFormat:@"%.2f", [tempModel.risk_score floatValue]];
                } else if ([isUnLock isEqualToString:@"0"]) {
                    return @"----";
                }
                
            } else if (column == 4) {
                NSString *fengXianZhi = tempModel.risk_level;
                
                if ([isUnLock isEqualToString:@"1"]) {
                    if ([fengXianZhi isEqualToString:@"0"]) {
                        // 说明是低风险
                        return @"低";
                    } else if ([fengXianZhi isEqualToString:@"1"]) {
                        // 说明是较低风险
                        return @"较低";
                    } else if ([fengXianZhi isEqualToString:@"2"]) {
                        // 说明是正常风险
                        return @"正常";
                    } else if ([fengXianZhi isEqualToString:@"3"]) {
                        // 说明是较高风险
                        return @"较高";
                    } else if ([fengXianZhi isEqualToString:@"4"]) {
                        // 说明是高风险
                        return @"高";
                    }
                } else if ([isUnLock isEqualToString:@"0"]) {
                    return @"----";
                    
                }
                
            }
        } else if (self.isDiease == NO) {
            // 单项
            // 获取具体数值
            ZGWDiseaseOnShiLiBaoGaoModel *tempModel = self.jianCeResultArray[row];
            if (column == 0) {
                // 疾病的名字
                return tempModel.name;
            }
        }
      
    }
    return nil;
}

- (UIFont *)formViewFontOfContent:(KWFormView *)formView
{
    // return [UIFont fontWithName:@"Arial-BoldMT" size:k13Big];
    return [UIFont systemFontOfSize:k13Big];
}

- (BOOL)formView:(KWFormView *)formView addActionForColumn:(NSInteger)column inRow:(NSInteger)row
{
    return YES;
}

// 点击cell的回调
- (void)formView:(KWFormView *)formView didSelectColumn:(NSInteger)column inRow:(NSInteger)row
{
    
    if (formView.tag == 302) {
        if (column == 0 || column == 1) {
            if ([self.delegate respondsToSelector:@selector(clickWhatRowCell:isUnLock:cellIndexPath:)]) {
                if (self.jianCeResultArray.count > row) {
                    ZGWDiseaseOnShiLiBaoGaoModel *model = self.jianCeResultArray[row];
                    NSString *isUnlock = model.is_unlock;
                    if ([isUnlock isEqualToString:@"1"]) {
                        //   [self.delegate clickWhatRowCell:row isUnLock:@"YES" cellIndexPath:];
                        [self.delegate clickWhatRowCell:row isUnLock:@"YES" cellIndexPath:self.myIndexPath];
                    } else if ([isUnlock isEqualToString:@"0"]) {
                        // [self.delegate clickWhatRowCell:row isUnLock:@"NO"];
                        [self.delegate clickWhatRowCell:row isUnLock:@"NO" cellIndexPath:self.myIndexPath];
                    }
                }
                
            }
        }
    }
}

@end
